export type PoiPhoto = {
  title: string;
  url: string;
};

// 基本的地点信息
export interface IPoi {
  adcode: string; // "360113"
  address: string; // 丰和南大道696号
  adname: string;
  citycode: string;
  cityname: string;
  id: string;
  longitude: number; // 经度
  latitude: number; // 纬度
  name: string; // 地区名称
  pcode: string;
  photos: PoiPhoto[];
  pname: string;
  postcode: string;
  extdata: {
    flag?: boolean; // 是否是用户的标记
  };
}

// 扩展的地点信息，包含更多的信息，如 m_id, u_id
export interface IPoiExt extends IPoi {
  m_id: number; // marker id
  u_id: number; // user id
  createdAt: string; // 创建时间
  updatedAt: string; // 更新时间
}

export const poiPropObj = {
  adcode: String, // "360113"
  address: String, // 丰和南大道696号
  adname: String,
  citycode: String,
  cityname: String,
  id: String,
  latitude: Number, // 纬度
  longitude: Number, // 经度
  name: String, // 地区名称
  pcode: String,
  photos: Array,
  pname: String,
  postcode: String,
  extdata: Object, // 扩展数据
};

export const poiExtPropObj = Object.assign({}, poiPropObj, {
  m_id: {
    type: Number,
  },
  u_id: {
    type: Number,
  },
  createdAt: {
    type: String,
  },
  updatedAt: {
    type: String,
  },
});

export interface IMarkerIconExposedProps {
  setActive: (b: boolean) => void;
  poi: IPoiExt;
  container: HTMLElement;
}

export interface IPoiSearchResult {
  count: number; // 总数
  pageIndex: number; // 当前页
  pageSize: number; // 每页数量
  pois: IPoi[]; // poi列表
}
